/*
 * Copyright 2010 Dovado FZ-LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.dovado.dovadoremote;

import android.app.Activity;
import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.view.KeyEvent;
import android.widget.ImageView;

public class Routers extends Activity {

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.routers);

		/*
		 * Display the wonderful logo:
		 */
		ImageView i = (ImageView) findViewById(R.id.dovadologo);
		i.setImageResource(R.drawable.logo);

		/*
		 * Display 4gr and 3gn logos
		 */
		BitmapFactory.Options options = new BitmapFactory.Options();
		Bitmap bitmap = BitmapFactory.decodeResource(getResources(),
				R.drawable.image4gr, options);

		ImageView image4gr = (ImageView) findViewById(R.id.image4gr);
		image4gr.setMaxHeight((int) (bitmap.getHeight() / 1.1));
		image4gr.setImageResource(R.drawable.image4gr);
		image4gr.setAdjustViewBounds(true);

		ImageView image3gn = (ImageView) findViewById(R.id.image3gn);
		image3gn.setMaxHeight((int) (bitmap.getHeight() / 1.1));
		image3gn.setImageResource(R.drawable.image3gn);
		image3gn.setAdjustViewBounds(true);
	}

	/*
	 * If the user presses the 'back'-button (we can add some more functionality
	 * here
	 */
	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (keyCode == KeyEvent.KEYCODE_BACK) {
			Intent i = new Intent();
			i.setAction(Intent.ACTION_MAIN);
			i.addCategory(Intent.CATEGORY_HOME);
			this.startActivity(i);
			return true;
		}
		return false;
	}

}